package com.wuzhiming.istudy.mapper;

import com.wuzhiming.istudy.pojo.Course;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @ClassName: CourseMapper
 * @Description: 课程mapper
 * @Author:zhimingw
 * @Version 1.0
 * @since 2022/3/5 15:26
 */
@Mapper
public interface CourseMapper {
    /**
     * @Description: 添加Course
     * @Param: [article]
     * @return: int
     * @Author: zhimingw
     * @Date: 2021/5/31
     */
    int insert(Course course);

    /**
    * @Description: 通过课程类别id查询
    * @Param: [id]
    * @return: java.util.List<com.wuzhiming.istudy.pojo.Course>
    * @Author: zhimingw
    * @Date: 2022/3/5
    */
    List<Course> queryAllByTypeId(Integer courseTypeId);

    /***
    * @Description: 通过课程id查询课程详情
    * @Param: [courseId]
    * @return: com.wuzhiming.istudy.pojo.Course
    * @Author: zhimingw
    * @Date: 2022/3/6
    */
    Course queryById(Integer id);

    /**
     * @Description: 根据条件获取课程数量
     * @Param: [status]
     * @return: java.lang.Integer
     * @Author: zhimingw
     * @Date: 2021/5/31
     */
    Integer totalCount(Integer status);

    /**
     * @Description: 根据状态获取课程
     * @Param: [status]
     * @return: java.util.List<top.zhimingw.pojo.Article>
     * @Author: zhimingw
     * @Date: 2021/5/31
     */
    List<Course> queryByStatus(Integer status);

    /**
     * @Description: 修改Course,根据 course 的主键修改数据
     * @Param: [article]
     * @return: int
     * @Author: zhimingw
     * @Date: 2021/5/31
     */
    int update(Course course);

    /**
     * @Description: 删除Course
     * @Param: [id]
     * @return: int
     * @Author: zhimingw
     * @Date: 2021/5/31
     */
    int deleteById(Integer id);

    /**
     * @Description: 删除全部回收站课程
     * @Param: []
     * @return: java.lang.Integer
     * @Author: zhimingw
     * @Date: 2021/5/31
     */
    Integer deleteTrash();
    
    /**
    * @Description: 获得热度前5课程
    * @Param: []
    * @return: java.util.List<com.wuzhiming.istudy.pojo.Course>
    * @Author: zhimingw
    * @Date: 2022/4/4
    */
    List<Course> getHotCourse();

    /**
    * @Description: 通过课程阶段id查询
    * @Param: [courseStageId]
    * @return: java.util.List<com.wuzhiming.istudy.pojo.Course>
    * @Author: zhimingw
    * @Date: 2022/4/4
    */
    List<Course> getCourseByStageId(Integer courseStageId);

    /**
    * @Description: 更改课程浏览次数
    * @Param: [id]
    * @return: java.lang.Integer
    * @Author: zhimingw
    * @Date: 2022/4/5
    */
    Integer updateCourseRC(Integer id);
}
